Virtual memory management systems in computer systems provide for the use of secondary storage devices, such as disk storage devices, to supplement physical memory, such as RAM, in order to increase the logical memory capacity of the computer system. Physical memory is used by processes executing in the computer system until the capacity of physical memory is reached, at which point blocks of data in the physical memory are copied to the secondary storage device in order to free up physical memory. Subsequently, when the copied blocks are later required, they can be copied back into physical memory. The blocks are commonly referred to as “pages” and have a size determined by the hardware or software of the computer system. This approach to virtual management can therefore be known as paged memory management.
FIG. 1 is a schematic diagram illustrating a conceptual paged memory management system for a computer system as is well known in the prior art. A software process 102 resident in a memory of the computer system and executing on a processor of the computer system includes a set of resident pages 104. Resident pages 104 are so-called because they are present in the physical memory of the computer system. Additionally, process 102 has further pages 108 which are not resident in physical memory but are instead stored on a secondary storage device 106 such as a disk storage device or a secondary memory storage. These further non-resident pages are called “paged-out” pages 108.
The computer system further includes a memory paging subsystem 110, which is a hardware or software component for providing virtual memory and memory paging services to processes executing in the computer system. For example, the memory paging subsystem 110 can be a facility provided by an operating system executing on the computer system. The memory paging subsystem 110 is responsive to memory access requests from software process 102 and in the event of a requirement to provide free physical memory, or to swap one or more resident pages 104 with one or more paged-out pages 108, undertakes these tasks. Inevitably, these tasks will involve the memory paging subsystem 110 identifying one or more of the resident pages 104 to be paged-out to the secondary storage device 106, and therefore involves an identification of which of the resident pages 104 is most appropriate for paging-out.
One way of identifying which of the resident pages 104 should be paged-out is to determine first which of the resident pages 104 the software process 102 is likely to require in physical memory in the near future. In this way, those pages which are less likely to be required by process 102 can be considered for paging-out. It is difficult to know with certainty which pages are or are not likely to be required since events in the execution of software process 102 which have not yet occurred may determine what branch in the process 102 will take and thus what memory will need to be accessed.
To address this problem, the memory paging subsystem 110 can operate on the principle that memory access by process 102 in the near future will be the same as memory access in the recent past. To this end, memory paging subsystem 110 maintains a list of memory pages accessed by process 102 in least recently used order as process page use information 112. Thus, when it is necessary for the memory paging subsystem 110 to identify one of the resident pages 104 for paging-out, pages which have been least recently used according to the process page use information 112 are preferred candidates.
This approach is effective for a software process 102 where past behavior is a good indicator of future behavior. However, some software processes execute in multiple modes, or phases, of operation. Each mode can involve very different behavioral characteristics which result in the process behaving in one manner in one mode and another manner in a different mode.
FIG. 2 is a block diagram illustrating a software process 102 executing in two modes. The software process 102 initially executes in a first mode of operation 202. For example, the first mode 202 can be an initial mode of operation on startup of the process 102, or a business logic mode wherein the process 102 undertakes operations to solve business problems. Alternatively, the first mode 202 can be an active mode, as opposed to an inactive or suspended mode. Further alternatively, the first mode 202 can be the mode of operation in which the process 102 executes for the majority of the total execution time. Other examples of a first mode 202 of operation will be apparent to those skilled in the art. In the first mode 202, the process 102 behaves in a way which results in a particular profile of memory accesses. For example, a particular subset of memory pages may be frequently accessed. Consequently, during execution in the first mode 202, the process page use information 112 reflects the memory page usage of the process 102 in the first mode 202 of operation.
After some time the process 102 switches to a second mode of operation 204. For example, the second mode of operation 204 can be a housekeeping mode, such as garbage collection, data compression, auditing, tracing, logging, monitoring, scanning or sweeping. Alternatively, the second operating mode could be a suspended operating mode, as opposed to an active operating mode. Such a suspended operating mode can include suspension of execution of the process 102, or removal of power from the computer system.
Other examples of a second mode 204 of operation will be apparent to those skilled in the art. In the second mode 204, the process behaves in a way which is different than the first mode 202, and in particular, which involves a different profile of memory accesses. For example, a different subset of memory pages may be accessed by the process 102 in the second mode 204 compared to the subset of memory pages accessed in the first mode 202. Alternatively, in the second mode 204, the process 102 may be required to access each and every memory page as part of a general housekeeping operation. Consequently, during execution in the second mode 204, the process page use information 112 reflects the memory page usage of the process 102 in the second mode 204 of operation.
Further after some time, the process 102 leaves the second mode of operation 204 and returns to the first mode of operation 202. For example, a switch back to the first mode 202 might occur on completion of a housekeeping task in the second mode of operation 204. Whilst the profile of memory accesses in the first mode 202 is different than that of the second mode 204, the process page use information 112 at the point when the process 102 returns to the first mode of operation 202 continues to reflect the second mode of operation 204 in which the process was previously executing.
Since the first mode of operation 202 has a profile of memory accesses which is different than that of the second mode 204, the process page use information 112 is inaccurate for the first mode 202 and results in an inefficient management of memory pages by the memory paging subsystem 110. This inefficient management of memory pages arises because the page use information 112 reflects pages used in the second mode of operation 204 where memory access requirements were different than the first mode of operation 202. This can result in resident pages 104 being paged out inappropriately by the memory paging subsystem 110. It would therefore be advantageous to provide for efficient memory paging for software processes which operate in multiple different modes, each mode having different memory access requirements.